import React from 'react'
import AutoComplete from 'src/components/AutoComplete'

const index = () => {
  const getOptions = async (inputValue: string): Promise<string[]> => {

    // 模拟异步加载选项
    return new Promise((resolve) => {
      setTimeout(() => {
        const options = ['Apple', 'Banana', 'Cherry', 'Durian', 'Elderberry'].filter((option) =>
          option.toLowerCase().includes(inputValue.toLowerCase())
        );
        resolve(options);
      }, 1000);
    });
  };
  return (
    <div>
      <AutoComplete getOptions={getOptions}
      onSelect={function (selectedOption: string): void {
        console.log("selectedOption", selectedOption)
      }} />
    </div>
  )
}

export default index
